package cn.edu.dgut.sai.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.env.Environment;
import org.springframework.core.env.PropertySources;

/**
 * 企业级软件开发-实训课程：Spring Boot 2.x
 *
 * @author 黎志雄
 * 2019-9-17
 */
@Configuration
public class PropertyPlaceholderConfiguration {

	/**
	 * 属性源占位符适配器
	 *
	 * 配合@Value注解使用，解释${...}点位符，然后从Spring容器的{@link Environment} 和它的 {@link PropertySources} 集合中查找属性值，并注入到带有@Value注解的成员变量。.
	 *
	 * @return {@link PropertySourcesPlaceholderConfigurer}
	 */
	@Bean
	public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
		return new PropertySourcesPlaceholderConfigurer();
	}

}
